package com.zy.imagineCommunity.dao;

import com.zy.imagineCommunity.entity.*;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface CommentMapper {

    //通过blogId分页查询评论
    List<CommentText> queryCommentsByBlogIdAndBeginAndPageSize(int blogId, int begin, int pageSize);

    //通过blogId查询评论数量
    int queryCommentsCountByBlogId(int blogId);

    //通过品论Id分页查询评论
    List<ReplyText> queryReplyByCommentId(int commentId);

    //增加评论
    int addComment(Comment comment);

    //增加评论回复
    int addReply(Reply reply);

    //根据用户id查找自己的评论
    List<CommentTextTwo> queryPersonalCommentsByUserIdAndBeginAndPageSize(int userId, int begin, int pageSize);

    //通过用户id查找个人评论数量
    int queryPersonalCommentsCountTotalByUseId(int userId);

    //通过id删除评论
    void deleteCommentByCommentId(int commentId);

    //通过评论id删除下面的回复
    void deleteReplyByCommentId(int commentId);

    //查询总的评论
    List<CommentTextThree> queryCommentsByBeginAndPageSize(int begin, int pageSize);

    //查询总评论数
    int queryCommentsCountTotal();

    //查询总的回复
    List<ReplyTextTwo> queryReplyTextByBeginAndPageSize(int begin, int pageSize);

    //查询总回复数
    int queryReplyCountTotal();

    void deleteReplyById(int id);

    //分类查询评论
    List<CommentTextThree> queryCommentsByTypeAndBeginAndPageSize(int type, int begin, int pageSize);

    //查询总评论数
    int queryCommentsCountTotalByType(int type);

    //查询总的回复
    List<ReplyTextTwo> queryReplyTextByTypeAndBeginAndPageSize(int type, int begin, int pageSize);

    //查询总回复数
    int queryReplyCountTotalByType(int type);

    /**
     * 查询用户的回复
     *
     * @param userId
     * @param begin
     * @param pageSize
     * @return
     */
    List<ReplyTextTwo> queryPersonalReplyTextByUserIdAndBeginAndPageSize(int userId, int begin, int pageSize);

    /**
     * 查询用户总回复数
     *
     * @param userId
     * @return
     */
    int queryPersonalReplyCountTotalByUserId(int userId);

}
